<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
     <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=basePath %>js/jquery.js"></script>
<title>Game Data</title>
<style>
thead
{
	font-weight: bold;
	background-color: #6589D1;
	color:white;
	font-family: arial;;
}

tbody
{
	background-color: #DAE6FF;
}

body
{
	padding-left: 150px;
}
</style>
<script>
function delItem(id)
{
	var result=window.confirm("Are you sure to delete it?After deleting it can't be restored!");
	if(result==true)
		window.location.href="gameAction!delItem.action?id="+id;	
}
</script>
</head>
<body>
<a href="gameAction!addItem.action">Add</a>
<table>
<thead><tr><td>ID</td><td>name</td><td>HP</td><td>MP</td><td>Damage</td>
<td>Defend</td><td style="width:200px;">effect</td><td>type</td><td>theme</td>
<td>operation</td></tr></thead>
<tbody>
<c:forEach items="${items }" var="i">
<tr><td>${i.id }</td><td>${i.name }</td><td>${i.hp }</td><td>${i.mp }</td><td>${i.damage }</td>
<td>${i.defend }</td><td>${i.effect }</td><td >${i.itemType.name}</td><td >${i.itemTheme.name }</td>
<td><a href="gameAction!editItem.action?id=${i.id }">Edit</a>/<a href="javascript:delItem(${i.id })">Delete</a></td></tr>
</c:forEach>
</tbody>
</table>
</body>
<script type="text/javascript">

</script>
</html>